
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>奖惩信息查询</title>
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">
    <link rel="stylesheet" href="/css/notice/noticeManagement.css">
    <script src="/js/common/language.js"></script>
    <%--<script src="/js/jquery/jquery.cookie.js"></script>--%>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>
        table tbody td{
            text-align: left;
            padding: 10px;
            box-sizing: border-box;
        }
        table tbody td.color{
            padding:10px 10px 10px 50px;
        }
        input{
            float: none;
        }
        .editAndDelete3{
            color: red;
        }
        .color{
            font-size: 11pt;
            color: #2a588c;
            font-weight: bold;
        }
        table tbody td textarea{
            width: 229px;
            height: 34px;
            line-height: 34px;
            padding-left: 10px;
            outline: none;
            border-radius: 4px;
            vertical-align: middle;
            font-family:"Microsoft Yahei";
        }
        table tbody td a{
            vertical-align: middle;
            font-size: 11pt;
        }
        table tbody td select{
            width: 119px;
            height: 28px;
            border-radius: 4px;
        }
        table tbody td input[type=text]{
            width: 288px;
            height: 32px;
            border-radius: 4px;
            padding-left: 10px;
            box-sizing: border-box;
        }
        .btnsava{
            padding:5px 15px;
            border-radius: 4px;
            background: #2F8AE3;
            color: #fff;
        }
        .pagediv .page-bottom-outer-layer table td{
            text-align: left;
        }
        #pagediv{
            width: 100%;
        }
        #pagediv table{
            width: 98%;
            margin: 0 auto;
        }
        #pagediv table tr:nth-child(odd){
            background-color: #F6F7F9;
        }
        #pagediv table tr:nth-child(even){
            background-color: #ffffff;
        }
        #pagediv table tr th{
            padding: 8px;
            font-size: 13pt;
            color: #2F5C8F;
            font-weight: bold;
            text-align: left;
        }
        #pagediv table tr td{
            padding: 8px;
            font-size: 11pt;
            text-align: left;
            height: 30px;
            line-height: 30px;
            word-break: keep-all;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        .deleteAll{
            display: inline-block;
            width: 70px;
            height: 28px;
            position: relative;
            color: #ffffff;
            border-radius: 3px;
            background: #2b7fe0;
            text-align: center;
            line-height: 28px;
            margin-left: 20px;
        }
        .del{
            color: #e01919;
        }
    </style>
    <%--<script src="/js/notice/theQuery.js"></script>--%>
</head>
<body>
<div class="navigation">
    <img src="/img/commonTheme/${sessionScope.InterfaceModel}/gonggaochaxun.png" alt="">
    <h2>考核任务查询</h2>
</div>
<div class="query">
    <div class="header">考核信息查询</div>
    <form id="ajaxform" action="">
        <input type="hidden" name="changeId" value="1">
        <input type="hidden" name="exportId" value="">
        <table style="width: 100%;    border: 1px solid #c0c0c0;
    border-top: none;">
            <tbody>
            <tr class="borderNone">
                <td width="30%" class="color">考核任务标题：</td>
                <td width="70%">
                    <input  type="text" name="incentiveAmount" id="budgetItemNo">
                </td>
            </tr>
            <%--<tr class="borderNone">--%>
                <%--<td width="30%" class="color">考核人：</td>--%>
                <%--<td width="70%">--%>
                    <%--<span><input disabled type="text" id="department"></span>--%>
                    <%--<a href="javascript:;" ><span class="btn adddept">添加</span></a>--%>
                    <%--<a href="javascript:;"><span class="btn clear del">清除</span></a>--%>
                <%--</td>--%>
            <%--</tr>--%>
            <tr class="borderNone">
                <td width="30%"  class="color">被考核人：</td>
                <td width="70%">
                    <input disabled class="td_title1 release1" id="itemExecuter" type="text" username="">
                    <a href="javascript:;" class=" ml8 userPrivAdd btn add4" name="orgAdd">添加</a>
                    <a href="javascript:;" class=" ml8 userPrivClear btn clear4 del" name="orgClear">清除</a>
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%"  class="color">考核试卷：</td>
                <td width="70%">
                    <input type="hidden" name="incentiveType" value="">
                    <select name="postPriv" class="BigSelect" id="newpriveItem">
                        <option value="">请选择</option>
                    </select>
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%"  class="color"> 生效日期：</td>
                <td width="70%">
                    <input style="width: 100px" type="text" id="newbudgetItemBegintime" name="incentiveTime" readonly="readonly" onclick="laydate({format: 'YYYY-MM-DD'})">
                    至
                    <input style="width: 100px" type="text" id="newbudgetItemEndtime" name="incentiveTime" readonly="readonly" onclick="laydate({format: 'YYYY-MM-DD'})">
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%"  class="color"> 终止日期：</td>
                <td width="70%">
                    <input style="width: 100px" type="text" id="newbudgetItemBegintime1" name="incentiveTime" readonly="readonly" onclick="laydate({format: 'YYYY-MM-DD'})">
                    至
                    <input style="width: 100px" type="text" id="newbudgetItemEndtime1" name="incentiveTime" readonly="readonly" onclick="laydate({format: 'YYYY-MM-DD'})">
                </td>
            </tr>
            <tr class="borderNone">
                <td width="30%"  class="color"> 查询范围：</td>
                <td width="70%">
                    <input type="radio" name="flowFlag" value="2" checked="checked">全部
                    <input type="radio" name="flowFlag" value="1">已终止
                </td>
            </tr>
            <tr class="borderNone">
                <td colspan="2" style="text-align: center">
                    <a href="javascript:;" class="btnsava" id="queryBtn"><fmt:message code="global.lang.query"/></a>
                </td>
            </tr>

            </tbody>
        </table>
    </form>
</div>
<div id="pagediv" style="display: none;">
    <table cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
        <thead>

        <tr style="background: none">
            <th style="width:12%">考核任务名称	</th>
            <%--<th>考核人</th>--%>
            <th>被考核人</th>
            <th style="width:12%">考核试卷</th>
            <th style="width:12%">生效日期</th>
            <th style="width:12%">终止日期	</th>
            <th>状态</th>
            <th style="width: 25%">操作</th>
        </tr>

        </thead>
        <tbody id="trList">

        </tbody>
    </table>
    <div class="right" style="margin-right: 10%;">
        <!-- 分页按钮-->
        <div class="M-box3" id="dbgz_pagesd"></div>
    </div>
</div>

<script type="text/javascript">
    var user_id='';
    var data={};
    //未定义
    function undefindData(data) {
        if(data == undefined){
            return '';
        }else{
            return data;
        }
    }
    // $('.adddept').click(function(){
    //     user_id='department';
    //     /*$.popWindow("../../common/roleMapper");*/
    //     $.popWindow("../../common/selectUser");
    // })
    $('.add3').click(function(){
        user_id='itemManager';
        $.popWindow("../../common/selectUser");
    })
    $('.add4').click(function(){
        user_id='itemExecuter';
        $.popWindow("../../common/selectUser");
    })
    // $('.clear').click(function () {
    //     $('#department').attr("privid", "");
    //     $('#department').attr("userpriv", "");
    //     $('#department').attr("user_id", "");
    //     $('#department').val("");
    // });
    // 清空人员信息
    $('.clear3').click(function () {
        $('#itemManager').attr("privid", "");
        $('#itemManager').attr("userpriv", "");
        $('#itemManager').attr("user_id", "");
        $('#itemManager').val("");
    });
    $('.clear4').click(function () {
        $('#itemExecuter').attr("privid", "");
        $('#itemExecuter').attr("userpriv", "");
        $('#itemExecuter').attr("user_id", "");
        $('#itemExecuter').val("");
    });
    $.ajax({
        type:'get',
        url:'/ScoreGroupLeader/selScoreGroup?typeId=0',
        dataType:'json',
        success:function(res){
            var str='';
            if(res){
                $.each(res.obj,function(index,item){
                    str+='<option value="'+item.groupId+'">'+item.groupName+'</option>'
                });
                $('#newpriveItem').append(str);
            }
        }
    });
    $('#queryBtn').on('click',function() {
        $('.query').hide();
        $('#pagediv').show();
        var kaoheName = $('#budgetItemNo').val();
        /*var deptNames = $('#deptNames').val();
        var query_toId = $('#query_toId').val();*/
        // var rankman = $('#department').attr("user_id");
        var itemManager = $('#itemExecuter').attr("user_id");
        var kaoheBiaoji = $("#newpriveItem option:selected").val();
        var budgetItemBegintime = $('#newbudgetItemBegintime').val();
        var budgetItemEndtime = $("#newbudgetItemEndtime").val();
        var budgetItemBegintime1 = $('#newbudgetItemBegintime1').val();
        var budgetItemEndtime1 = $("#newbudgetItemEndtime1").val();
        var flowFlag2 = $("input[name=flowFlag]:checked").val();
        var ajaxPage = {
            data: {
                page: 1,//当前处于第几页
                pageSize: 5,//一页显示几条
                useFlag: true,
                flowTitle:kaoheName,
                // rankman:rankman,
                participant:itemManager,
                groupId:kaoheBiaoji,
                bDataB:budgetItemBegintime,
                bDataE:budgetItemEndtime,
                eDataB:budgetItemBegintime1,
                eDataE:budgetItemEndtime1,
                flowFlag2:flowFlag2
            },
            page: function () {
                var me = this;
                $('taskBody').html('');
                layer.msg('加载中', {
                    icon: 16
                    ,shade: 0.01
                });
                $.post('/ScoreFlowLeader/selAllScoreFlow', me.data, function (json) {
                    var str = '';
                    var arr = json.obj;
                    if(arr.length){
                        $.each(json.obj, function (index, item) {
                            str += '<tr groupId="'+item.groupId+'" flowId="'+item.flowId+'" flowFlag="'+item.flowFlag+'">' +
                                '<td title="'+undefindData(item.flowTitle) +'">' + undefindData(item.flowTitle) + '</td>' +
                                // '<td title="'+undefindData(item.rankmanName)+'"><a href="javascript:;" class="kaoherankman">'+ undefindData(item.rankmanName)+ '</a></td>' +
                                '<td title="'+undefindData(item.participantName) +'"><a href="javascript:;" class="kaoheparticipant">' + undefindData(item.participantName) + '</a></td>' +
                                '<td title="'+undefindData(item.groupName)+'"><a href="javascript:;" class="kaohegroupName">' + undefindData(item.groupName)+ '</a></td>' +
                                '<td title="'+undefindData(item.beginDateStr)+'">' + undefindData(item.beginDateStr)+ '</td>' +
                                '<td title="'+item.endDateStr +'">' + function () {
                                    if(item.flowFlag=='0' ){
                                        return ''
                                    }else{
                                        return undefindData(item.endDateStr)
                                    }
                                }()+ '</td>' +
                                '<td>' + function () {
                                    if(item.flowFlag=='0' ){
                                        return '<span style="color:#00AA00">生效</span>'
                                    }else{
                                        return '<span style="color:red">终止</span>'
                                    }
                                }()+ '</td>' +
                                '<td>' +
                                '<a class="look" href="javascript:;"  style="margin-right: 10px">查阅</a>' +
                                '</td>' +
                                '</tr>';

                        })
                        $('#trList').html(str)
                        layer.closeAll();
                        me.pageTwo(json.totleNum, me.data.pageSize, me.data.page)
                    }else{
                        layer.msg("暂无数据", {icon: 2})
                    }

                }, 'json')
            },
            pageTwo: function (totalData, pageSize, indexs) {
                var mes = this;
                $('#dbgz_page').pagination({
                    totalData: totalData,
                    showData: pageSize,
                    prevContent:'上一页',
                    nextContent:'下一页',
                    jump: true,
                    coping: true,
                    homePage: '',
                    endPage: '',
                    current: indexs || 1,
                    callback: function (index) {
                        mes.data.page = index.getCurrent();
                        mes.page();
                    }
                });
            }

        }
        ajaxPage.page();
    })
    //编辑
    $(document).on('click','.bianji',function () {
        var flowId=$(this).parent().parent().attr('flowId')
        $(window.parent.document).find('.main').find('iframe').prop('src','/ScoreFlowLeader/assessmentNewedit?type=0&&flowId='+flowId)
    })

    //查阅
    $(document).on('click','.look',function () {
        var flowId=$(this).parent().parent().attr('flowid');
        var groupId=$(this).parent().parent().attr('groupid');
        $.popWindow("assessmentQueryDetail?flowId="+flowId+"&groupId="+groupId,'查阅情况','0','0','1150px','600px');
    })

    //删除
    $('table').on('click','.del',function(){
        var flowId=$(this).parent().parent().attr('flowId')
        layer.open({
            type: 1,
            title: ['提示','background-color:#2e8ded;color:#fff'],
            content:'<div style="text-align: center;margin-top: 18px;">确认删除吗？</div>',
            area: ['200px', '160px'],
            btn: ['确认','取消'],
            yes:function(index){
                $.ajax({
                    url:'/ScoreFlowLeader/delScoreFlow',
                    type:'post',
                    data:{
                        'flowId':flowId,
                    },
                    dataType:'json',

                    success:function(res){
                        layer.close(index)
                        if(res){
                            layer.msg("删除成功",{
                                icon: 1,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href="/ScoreFlowLeader/assessmentTaskment "
                            })
                        }else {
                            layer.msg("删除失败",{
                                icon: 2,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href="/ScoreFlowLeader/assessmentTaskment"
                            })
                        }
                    }
                })
            },
            btn2: function (index) {
                layer.close(index)
            },
            btnAlign:'c',

        })
    });
    //考核情况
    $('table').on('click','.kaohe',function(){
        var flowId=$(this).parent().parent().attr('flowId')
        var participant=$(this).parent().parent().attr('participant')
        layer.open({
            title: ['考核情况', 'background-color:#2b7fe0;color:#fff;'],
            area: ['500px', '350px'],
            shadeClose: false, //点击遮罩关闭
            content: ' <table><thead><tr><th>考核人员</th><th>已考核人员</th><th>未考核人员</th></tr></thead><tbody id="bodywarp"></tbody></table>',
            btn: ['取消'],
            success:function(){
                $.ajax({
                    type:'get',
                    url:'/ScoreSelfDataController/getKaohe',
                    dataType:'json',
                    data:{
                        flowId:flowId,
                        examiner:participant
                    },
                    success:function(res){
                        var str='';
                        var item = res.obj;
                        str += '<tr>' +
                            '<td>' +item[0] + '</td>' +
                            '<td>' + undefindData(item[1])+ '</td>' +
                            '<td>' + undefindData(item[2])+ '</td>' +
                            '</tr>';


                        $('#bodywarp').html(str)
                    }
                });
            },
            yes:function(index){
                layer.close(index);
            }
        })
    });
    // //考核人
    // $('table').on('click','.kaoherankman',function(){
    //     var rankman=$(this).parent().parent().attr('rankman')
    //     layer.open({
    //         title: ['考核情况', 'background-color:#2b7fe0;color:#fff;'],
    //         area: ['500px', '350px'],
    //         shadeClose: false, //点击遮罩关闭
    //         content: ' <table><thead><tr><th>考核人员</th><th>部门</th><th>角色</th><th>打分状态</th></tr></thead><tbody id="bodywarp"></tbody></table>',
    //         btn: ['取消'],
    //         success:function(){
    //             $.ajax({
    //                 type:'get',
    //                 url:' /ScoreFlowLeader/selUserByUserId',
    //                 dataType:'json',
    //                 data:{
    //                     userId:rankman
    //                 },
    //                 success:function(res){
    //                     var str='';
    //                     $.each(res.obj, function (index, item) {
    //                         str += '<tr>' +
    //                             '<td title="'+item.userName+'">' + item.userName+ '</td>' +
    //                             '<td title="'+item.deptName +'">' + item.deptName + '</td>' +
    //                             '<td title="'+item.userPrivName +'">' + item.userPrivName + '</td>' +
    //                             '<td></td>' +
    //                             '</tr>';
    //
    //                     })
    //                     $('#bodywarp').html(str)
    //                 }
    //             });
    //         },
    //         yes:function(index){
    //             layer.close(index);
    //         }
    //     })
    // });
    //被考核人
    $('table').on('click','.kaoheparticipant',function(){
        var participant=$(this).parent().parent().attr('participant')
        layer.open({
            title: ['考核情况', 'background-color:#2b7fe0;color:#fff;'],
            area: ['500px', '350px'],
            shadeClose: false, //点击遮罩关闭
            content: ' <table><thead><tr><th>被考核人员</th><th>部门</th><th>角色</th></tr></thead><tbody id="bodywarp"></tbody></table>',
            btn: ['取消'],
            success:function(){
                $.ajax({
                    type:'get',
                    url:'/ScoreFlowLeader/selUserByUserId',
                    dataType:'json',
                    data:{
                        userId:participant
                    },
                    success:function(res){
                        var str='';
                        $.each(res.obj, function (index, item) {
                            str += '<tr>' +
                                '<td title="'+item.userName+'">' + item.userName+ '</td>' +
                                '<td title="'+item.deptName +'">' + item.deptName + '</td>' +
                                '<td title="'+item.userPrivName +'">' + item.userPrivName + '</td>' +
                                '</tr>';

                        })
                        $('#bodywarp').html(str)
                    }
                });
            },
            yes:function(index){
                layer.close(index);
            }
        })
    });
    //考核指标集
    $('table').on('click','.kaohegroupName',function(){
        var groupId=$(this).parent().parent().attr('groupId')
        layer.open({
            title: ['考核情况', 'background-color:#2b7fe0;color:#fff;'],
            area: ['500px', '350px'],
            shadeClose: false, //点击遮罩关闭
            content: ' <table><thead><tr><th>考核项目</th><th>分值范围</th><th>描述</th></tr></thead><tbody id="bodywarp"></tbody></table>',
            btn: ['取消'],
            success:function(){
                $.ajax({
                    type:'get',
                    url:'/ScoreItemLeader/selScoreItem',
                    dataType:'json',
                    data:{
                        groupId:groupId
                    },
                    success:function(res){
                        var str='';
                        $.each(res.obj, function (index, item) {
                            str += '<tr groupId="'+item.groupId+'" flowId="'+item.flowId+'">' +
                                '<td title="'+item.itemName+'">' + item.itemName+ '</td>' +
                                '<td>' + item.min +' ~ '+item.max+ '</td>' +
                                '<td title="'+item.itemExplain +'">' + item.itemExplain + '</td>' +
                                '</tr>';

                        })
                        $('#bodywarp').html(str)
                    }
                });
            },
            yes:function(index){
                layer.close(index);
            }
        })
    });
    //考核终止
    $('table').on('click','.zhongzhi',function(){
        var flowId=$(this).parent().parent().attr('flowId')
        var flowFlag=$(this).parent().parent().attr('flowFlag')
        var myDate = new Date()
        if(flowFlag==1){
            flowFlag=0
        }else{
            flowFlag=1
        }
        $.ajax({
            url:'/ScoreFlowLeader/stopNow',
            type:'post',
            data:{
                flowId:flowId,
                flowFlag:flowFlag,
                /* beginDateStr:myDate*/
            },
            dataType:'json',
            success:function(res){
                location.href = "/ScoreFlowLeader/assessmentTaskment"
            }
        })
    });
    //克隆
    $('table').on('click','.clone',function(){
        var flowId=$(this).parent().parent().attr('flowId')
        $.ajax({
            url:'/ScoreFlowLeader/kelong',
            type:'post',
            data:{
                flowId:flowId
            },
            dataType:'json',
            success:function(res){
                layer.msg("克隆成功", {
                    icon: 1,
                    time: 1500 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    location.href = "/ScoreFlowLeader/assessmentTaskment"
                });
            }
        })
    });
</script>

</body>
</html>